//
//  HomeVCBootoCell.swift
//  weibo1
//
//  Created by 李进 on 15/10/21.
//  Copyright © 2015年 李进. All rights reserved.
//

import UIKit

class HomeVCBootoCell: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setBOOTViewUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //懒加载，界面空件
    //转发按钮
    private lazy var forword:UIButton = UIButton(imageName: "timeline_icon_retweet", backImageName: nil, title: "转发", fontsize: 14, fontColor: UIColor.grayColor())
    
    //评论
    private lazy var comment:UIButton = UIButton(imageName: "timeline_icon_comment", backImageName: nil, title: "评论", fontsize: 14, fontColor: UIColor.grayColor())
    
    //赞
    private lazy var good:UIButton = UIButton(imageName: "timeline_icon_unlike", backImageName: nil, title: "赞", fontsize: 14, fontColor: UIColor.grayColor())

}

// MARK: - 设置界面控件
extension HomeVCBootoCell {
    
    func setBOOTViewUI(){
        
        self.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
        
        //添加控件
        addSubview(forword)
        addSubview(comment)
        addSubview(good)
        
        
        //设置自动布局
        forword.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.centerY.equalTo(self.snp_centerY)
            
        }
        
        comment.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(forword.snp_right)
            make.top.equalTo(self.snp_top)
            make.center.equalTo(self.snp_center)
            make.width.equalTo(forword.snp_width)
        }
        
        good.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(comment.snp_centerY)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(forword.snp_width)
        }
        
        //设置边界线
        // 3. 分隔视图
        // 布局
        let w = 0.5
        let scale = 0.4
        let sep1 = sepView()
        let sep2 = sepView()
        addSubview(sep1)
        addSubview(sep2)
        
        sep1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(forword.snp_right)
            make.centerY.equalTo(forword.snp_centerY)
            make.width.equalTo(w)
            make.height.equalTo(forword.snp_height).multipliedBy(scale)
        }
        sep2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(comment.snp_right)
            make.centerY.equalTo(forword.snp_centerY)
            make.width.equalTo(w)
            make.height.equalTo(forword.snp_height).multipliedBy(scale)
        }
        
       
        }
    }



private func sepView() -> UIView {
    let v = UIView()
    
    v.backgroundColor = UIColor.darkGrayColor()
    
    return v
    
}